package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入字符串");
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("not.txt",true), StandardCharsets.UTF_8);
        while (true){
            String  s = scanner.nextLine();
            if("exit".equalsIgnoreCase(s)){
                break;
            }
            osw.write(s);
        }
        osw.flush();
        osw.close();

    }
}
